﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Categories
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript" language="javascript">

    function RedirectToCategory(Category) {
        window.location = "../../Category/Item?Id=" + Category;
    }

</script>

<div id="content">
    
    <h2>Categories</h2>

    <hr /><hr />

    <table>
        <thead>
            <tr>
                <th width="150px"></th>
                <th width="570px">Description</th>
                <th width="75px" style="text-align:center;">Year</th>
            </tr>
        </thead>
        <tbody>
            <% foreach (var category in Model.Category)
               { %>
            <tr id="<%= Html.Encode(category.Id) %>">
                <td><input type="image" height="150px" width="150px" onclick="RedirectToCategory(<%= Html.Encode(category.Id) %>);" src="<%=Html.Encode(category.PictureLocation) %>" /></td>
                <td><%= Html.Encode(category.Description) %></td>
                <td style="text-align:center;"><%= Html.Encode(category.Year) %></td>
            </tr>
            <% } %>
        </tbody>
    </table>

</div>

</asp:Content>
